home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Mar 14, 1997
- // Author: ms
- //
- // Description:
- // This script defines detach on an active list
- //
-
- proc performDetachPresetSurfaces( int $history,
- int $rpo,
- string $surfaces[],
- string $results[] )
- {
- global int $gSelectNurbsSurfacesBit;
-
- string $cmd = "detachSurface" + " -ch " + $history +
- " -rpo " + $rpo + " ";
-
- string $results[];
- string $detachResults[];
-
- // for each string returned from groupObjectsByName, execute the command
- //
- string $groupStrings[];
- $groupStrings = groupObjectsByName( $surfaces, "\\[" );
- int $numStrings = size( $groupStrings );
-
- for( $i = 0; $i < $numStrings; $i ++ ) {
- // execute $cmd + $groupStrings[$i]
- if( catch( $detachResults = evalEcho( $cmd + $groupStrings[$i]))) {
- warning(" Problem evaluating detach command: " + $cmd + $groupStrings[$i]);
- }
- else {
- int $j;
- int $numResults = size( $results );
- int $numDetachResults = size( $detachResults );
- for( $j = 0; $j < $numDetachResults; $j ++, $numResults ++ ) {
- $results[$numResults] = $detachResults[$j];
- }
- }
- }
-
- if( 0 == size($results) ) {
- error ("Detach: failed on the input surfaces.");
- }
- }
-
- proc performDetachPresetCurves( int $history,
- int $rpo,
- string $curves[],
- string $results[] )
- {
- global int $gSelectNurbsCurvesBit;
-
- string $cmd = "detachCurve" + " -ch " + $history + " -cos on" +
- " -rpo " + $rpo + " ";
-
- string $results[];
- string $detachResults[];
-
- // for each string returned from groupObjectsByName, execute the command
- // So if the active list is: curve1.u[0.3] curve2.u[0.5] curve1.u[0.6]
- // these commands will be executed:
- // detachCurve <flags> curve1.u[0.3] curve1.u[0.6];
- // detachCurve <flags> curve2.u[0.5];
- //
- string $groupStrings[];
- $groupStrings = groupObjectsByName( $curves, "\\." );
- int $numStrings = size( $groupStrings );
-
- for( $i = 0; $i < $numStrings; $i ++ ) {
- // execute $cmd + names of curves
- if( catch( $detachResults = evalEcho( $cmd + $groupStrings[$i] ))) {
- warning(" Problem evaluating detach command: " + $cmd + $groupStrings[$i]);
- }
- else {
- int $j;
- int $numResults = size( $results );
- int $numDetachResults = size( $detachResults );
- for( $j = 0; $j < $numDetachResults; $j ++, $numResults ++ ) {
- $results[$numResults] = $detachResults[$j];
- }
- }
- }
-
- if( 0 == size($results) ) {
- error ("Detach: failed on the input curves.");
- }
- }
-
- global proc performDetachPreset( int $history, int $rpo )
- {
- // Get a list of each type of acceptable object type
- // curves, and curves-on-surface.
- //
- global int $gSelectCurveParmPointsBit;
- global int $gSelectEditPointsBit;
- global int $gSelectIsoparmsBit;
- string $curves[] = `filterExpand -ex true -sm $gSelectCurveParmPointsBit -sm $gSelectEditPointsBit`;
- string $surfaces[] = `filterExpand -ex true -sm $gSelectIsoparmsBit`;
-
- if( (0 == size($curves)) && (0 == size($surfaces)) ) {
- error ("Detach: Select point on curve or isoparm " +
- "on surface to do detach.");
- return;
- }
-
- int $doHilite = `shouldHiliteAfterCompute`;
-
- string $crvRes[], $srfRes[];
- if( size($curves) > 0 ) {
- performDetachPresetCurves( $history, $rpo, $curves, $crvRes );
- }
- if( size($surfaces) > 0 ) {
- performDetachPresetSurfaces( $history, $rpo, $surfaces, $srfRes );
- }
-
- if( (size($srfRes) + size($crvRes)) > 0 ) {
- int $n;
- string $select = "select ";
-
- $n = size($crvRes);
- for( $i=0; $i<$n; $i ++ ) {
- $select = $select + $crvRes[$i] + " ";
- }
-
- $n = size($srfRes);
- for( $i=0; $i<$n; $i ++ ) {
- $select = $select + $srfRes[$i] + " ";
- }
- select -cl;
- if( $doHilite ) $select += ";hilite;";
-
- eval( $select );
- }
- }
-